package com.sicheng.lc.周赛.分类.模拟;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/26 9:34
 */
public class 统计星号 {
    //https://leetcode.cn/problems/count-asterisks/
    public int countAsterisks(String s) {
        int total = 0;
        int t = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '|')
                t = (t + 1) % 2;
            else if (t == 0 && s.charAt(i) == '*')
                total++;
        }
        return total;
    }
}
